#! /usr/bin/python3
# _*_ coding:UTF-8 _*_
'''
    写一个decorator
'''
import functools


def log(func):
    print('开始进行修饰')
    @functools.wraps(func)
    def wrapper(*args, **kw):
        print('函数执行前')
        f = func(*args, **kw)
        print('函数执行后')
        return f
    return wrapper


@log
def sum(x, y):
    print('开始执行sum')
    return x + y


if __name__ == '__main__':
    print('开始调用sum')
    s = sum(2, 3)
    print(s)
